# Maintainer: David Runge <dvzrv@archlinux.org>

_name=pytest-datafixtures
pkgname=python-pytest-datafixtures
pkgver=1.0.0
pkgrel=4
pkgdesc="Data fixtures for pytest made simple"
arch=('any')
url="https://github.com/idlesign/pytest-datafixtures"
license=('BSD')
depends=('python-pytest')
makedepends=('python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz")
sha512sums=('7464f7df07ff5dd39ce0f4f315a601882541accdfcc84246a94140363e75ae9709daa2a4f6e493b7efe8b10be7aa438861c4c33e9ba8c128edd683c1419b7aa4')
b2sums=('fd49ecb54cc76ebce1f5bb93aade6d980992540644166dd9c91fc186313d8222e6b168c41d8e7c7d385422a2832722258b046c171ccd907db62d31c4ba3bace7')

prepare() {
  mv -v "${_name}-$pkgver" "$pkgname-$pkgver"
}

build() {
  cd "$pkgname-$pkgver"
  python setup.py build
}

check() {
  cd "$pkgname-$pkgver"
  export PYTHONPATH="build:${PYTHONPATH}"
  pytest -v
}

package() {
  cd "$pkgname-$pkgver"
  python setup.py install --skip-build \
                          --optimize=1 \
                          --root="${pkgdir}"
  install -vDm 644 {AUTHORS,CHANGELOG,README.rst} -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -vDm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
